package com.nstar.base.util
{
	import mx.utils.ObjectUtil;
	
	[Bindable]
	public class Logger
	{
		
		private static var instance:Logger;
		public var text:String = "";

		
		public function Logger(p:Protect) {
			
		}
		
		public static function getInstance(target:Object = null):Logger {
			if(instance == null) {
				instance = new Logger(new Protect());
			}
			
			return instance;
		}
		
		
		
		public function debug(message:Object):void {
			text += "[debug] "+DateUtils.format(new Date(),"YYYY/MM/DD HH:MS:SS")+" "+
				message.toString()+"\n";
		}
		
		public function info(message:Object):void {
			text += "[info] "+DateUtils.format(new Date(),"YYYY/MM/DD HH:MS:SS")+" "+
				message.toString()+"\n";
		}
		
		public function error(message:Object):void {
			text += "[error] "+DateUtils.format(new Date(),"YYYY/MM/DD HH:MS:SS")+" "+
				message.toString()+"\n";
		}
		
		public  function toString():String {
			return text;
		}
		
		public function clear() : void
		{
			text = "";
		}
		
		public function debugMore(msg:String,target:Object=null):void{
			text += "[debug] "+DateUtils.format(new Date(),"YYYY/MM/DD HH:MS:SS")+" "+
				msg+"\n"+ObjectUtil.toString(target)+"\n";			
		}
		
	}
}

class Protect {
	
}